/<template>
  <h2>我是About的内容</h2>
</template>

<script>
export default {
  name:'MyAbout',

  // 通过路由规则，进入该组件时被调用
  beforeRouteEnter(to,from,next){
    console.log('beforeRouteEnter', to, from);
    if (to.meta.isAuth) {
      if (localStorage.getItem('name') == '最爱喝兽奶') {
        next()
      } else {
        alert('名字不对，没有权限访问！！！')
      }
    } else {
      next()
    }
  },
  // 通过路由规则，离开该组件时被调用
  beforeRouteLeave(to,from,next){
    console.log('beforeRouteLeave',to,from);
    next()
  }
}
</script>

<style>

</style>